<template>
  <div class="knowledge-page container">
    <h1>环保知识</h1>
    
    <div class="search-bar">
      <input type="text" placeholder="搜索环保知识..." class="search-input" />
      <button class="search-button">
        <span>🔍</span>
      </button>
    </div>
    
    <div class="knowledge-categories">
      <div class="category-card green-gradient">
        <span class="category-icon">🌊</span>
        <h3>海洋保护</h3>
        <p>了解海洋生态系统和减少海洋污染的方法</p>
      </div>
      
      <div class="category-card blue-gradient">
        <span class="category-icon">♻️</span>
        <h3>垃圾分类</h3>
        <p>掌握正确的垃圾分类方法，促进资源回收利用</p>
      </div>
      
      <div class="category-card purple-gradient">
        <span class="category-icon">🌱</span>
        <h3>绿色生活</h3>
        <p>日常生活中的环保小技巧和可持续生活方式</p>
      </div>
      
      <div class="category-card orange-gradient">
        <span class="category-icon">🌡️</span>
        <h3>气候变化</h3>
        <p>了解气候变化的原因、影响和应对措施</p>
      </div>
    </div>
    
    <h2 class="section-title">热门文章</h2>
    
    <div class="article-list">
      <div class="article-card">
        <div class="article-image green-gradient"></div>
        <div class="article-content">
          <div class="article-tags">
            <span class="article-tag">海洋保护</span>
            <span class="article-tag">塑料污染</span>
          </div>
          <h3>塑料污染如何影响海洋生态？</h3>
          <p class="article-preview">每年有超过800万吨塑料进入海洋，对海洋生物和生态系统造成严重影响...</p>
          <div class="article-meta">
            <span class="article-date">2023年3月15日</span>
            <span class="article-views">2,345 阅读</span>
          </div>
        </div>
      </div>
      
      <div class="article-card">
        <div class="article-image blue-gradient"></div>
        <div class="article-content">
          <div class="article-tags">
            <span class="article-tag">垃圾分类</span>
            <span class="article-tag">可回收物</span>
          </div>
          <h3>常见垃圾分类误区解析</h3>
          <p class="article-preview">很多人对垃圾分类存在误解，本文将详细解析几种常见的垃圾分类误区...</p>
          <div class="article-meta">
            <span class="article-date">2023年4月2日</span>
            <span class="article-views">1,876 阅读</span>
          </div>
        </div>
      </div>
      
      <div class="article-card">
        <div class="article-image purple-gradient"></div>
        <div class="article-content">
          <div class="article-tags">
            <span class="article-tag">绿色生活</span>
            <span class="article-tag">节能减排</span>
          </div>
          <h3>10个简单的家庭节能方法</h3>
          <p class="article-preview">这些简单易行的节能方法不仅能减少碳排放，还能为您节省电费开支...</p>
          <div class="article-meta">
            <span class="article-date">2023年5月12日</span>
            <span class="article-views">3,210 阅读</span>
          </div>
        </div>
      </div>
    </div>
    
    <div class="newsletter">
      <h2>订阅环保新知</h2>
      <p>定期获取最新环保资讯、小贴士和活动信息</p>
      <div class="newsletter-form">
        <input type="email" placeholder="您的邮箱地址" class="newsletter-input" />
        <button class="newsletter-button">订阅</button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'KnowledgeView',
  data() {
    return {
      
    }
  }
}
</script>

<style scoped>
.knowledge-page {
  padding: 20px 0;
  max-width: 1200px;
  margin: 0 auto;
}

.search-bar {
  display: flex;
  margin: 20px 0 30px;
  max-width: 600px;
}

.search-input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 4px 0 0 4px;
  font-size: 16px;
  outline: none;
}

.search-input:focus {
  border-color: #4CAF50;
}

.search-button {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 0 20px;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  font-size: 18px;
}

.knowledge-categories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.category-card {
  padding: 25px;
  border-radius: 8px;
  color: white;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.category-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.category-icon {
  font-size: 36px;
  display: block;
  margin-bottom: 15px;
}

.category-card h3 {
  margin: 0 0 10px 0;
  font-size: 20px;
}

.category-card p {
  font-size: 14px;
  opacity: 0.9;
}

.green-gradient {
  background: linear-gradient(135deg, #43a047 0%, #1de9b6 100%);
}

.blue-gradient {
  background: linear-gradient(135deg, #1976d2 0%, #64b5f6 100%);
}

.purple-gradient {
  background: linear-gradient(135deg, #6a1b9a 0%, #ce93d8 100%);
}

.orange-gradient {
  background: linear-gradient(135deg, #e65100 0%, #ffb74d 100%);
}

.section-title {
  margin: 30px 0 20px;
  font-size: 24px;
  font-weight: 700;
  border-left: 4px solid #4CAF50;
  padding-left: 15px;
}

.article-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
}

.article-card {
  background-color: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.article-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.article-image {
  height: 180px;
}

.article-content {
  padding: 20px;
}

.article-tags {
  margin-bottom: 10px;
}

.article-tag {
  display: inline-block;
  background-color: #e8f5e9;
  color: #388e3c;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  margin-right: 5px;
}

.article-card h3 {
  margin: 0 0 10px 0;
  font-size: 18px;
}

.article-preview {
  color: #666;
  font-size: 14px;
  margin-bottom: 15px;
}

.article-meta {
  display: flex;
  justify-content: space-between;
  color: #999;
  font-size: 12px;
}

.newsletter {
  background-color: #f5f5f5;
  padding: 30px;
  border-radius: 8px;
  text-align: center;
  margin-top: 40px;
}

.newsletter h2 {
  margin: 0 0 10px 0;
}

.newsletter p {
  margin-bottom: 20px;
  color: #666;
}

.newsletter-form {
  display: flex;
  max-width: 500px;
  margin: 0 auto;
}

.newsletter-input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 4px 0 0 4px;
  font-size: 16px;
  outline: none;
}

.newsletter-button {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 0 20px;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  font-weight: 600;
}

@media (max-width: 768px) {
  .knowledge-categories {
    grid-template-columns: 1fr;
  }
  
  .article-list {
    grid-template-columns: 1fr;
  }
  
  .newsletter-form {
    flex-direction: column;
  }
  
  .newsletter-input, .newsletter-button {
    width: 100%;
    border-radius: 4px;
    margin-bottom: 10px;
  }
}
</style> 